<?php
if (!function_exists('squareit_objectsintoarray')) {

    function squareit_objectsintoarray($arrObjData, $arrSkipIndices = array())
    {
        $arrData = array();

        // if input is object, convert into array
        if (is_object($arrObjData)) {
            $arrObjData = get_object_vars($arrObjData);
        }

        if (is_array($arrObjData)) {
            foreach ($arrObjData as $index => $value) {
                if (is_object($value) || is_array($value)) {
                    $value = squareit_objectsintoarray($value, $arrSkipIndices); // recursive call
                }
                if (in_array($index, $arrSkipIndices)) {
                    continue;
                }
                $arrData[$index] = $value;
            }
        }
        return $arrData;
    }

}

/**
 *  Generates a message box
 *  - Prepare it so that it can be used across all square it plugins
 */
if (!function_exists('squareit_msg_box')) {

    function squareit_msg_box($msg, $type='updated')
    {
        echo '<div class="' . $type . '">
				' . $msg . '
			 </div>';
    }

}